import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

// 根据手机页面宽度修改html字体大小
import MobileAdaptation from "@/hooks/MobileAdaptation";
// 解决将非被动事件侦听器添加到滚动阻止“touchmove”，“touchstart”事件警告
import "default-passive-events";

// 引入vant组件库样式
import "vant/lib/index.css";
import "@/assets/style/common.less";
//字体图标
import "@/assets/font_icon/iconfont";
// import "@/assets/font_icon/user/iconfont";
// import "../src/assets/font_icon/iconfont";

const app = createApp(App);

// 使用vant3
import {
  Button,
  Tabbar,
  TabbarItem,
  Swipe,
  SwipeItem,
  Search,
  NavBar,
  Image as VanImage,
  Grid,
  GridItem,
  Cell,
  CellGroup,
  Icon,
  Form,
  Field,
  Picker,
  Area,
  Uploader,
  RadioGroup,
  Radio,
  Pagination,
  Divider,
  Checkbox,
  DatetimePicker,
  Toast,
  Dialog,
  Empty,
  Lazyload,
  Tag,
  ConfigProvider,
} from "vant";
app
  .use(Button) //按钮
  .use(Tabbar) //标签栏
  .use(TabbarItem)
  .use(Swipe) //轮播图
  .use(SwipeItem)
  .use(Search) //搜索
  .use(NavBar)
  .use(VanImage)
  .use(Grid)
  .use(GridItem)
  .use(Cell)
  .use(CellGroup)
  .use(Icon)
  .use(Form) //表单
  .use(Field) //表单项
  .use(Picker) //筛选弹出框
  .use(Area) //省市区选择
  .use(Uploader) // 上传文件
  .use(RadioGroup) //单选框
  .use(Radio)
  .use(Pagination)
  .use(Divider) //分割线
  .use(DatetimePicker) //时间选择器
  .use(Checkbox) //复选框
  .use(Dialog) //弹出框
  .use(Empty) // 空状态
  .use(Lazyload) //图懒加载
  .use(Toast)
  .use(Tag)
  .use(ConfigProvider);

// 导入goeasy 通讯
import GoEasy from "goeasy";

// 初始化
const goeasy = GoEasy.getInstance({
  host: "hangzhou.goeasy.io", //若是新加坡区域：singapore.goeasy.io
  appkey: "BC-78fe377cdd7e4bf5a2387655fabbff84",
  modules: ["pubsub"], //根据需要，传入‘pubsub’或'im’，或数组方式同时传入
});

// 建立连接
goeasy.connect({
  id: "001", //pubsub选填，im必填，最大长度60字符
  data: {
    avatar: "http://121.4.36.160:5000/1647004064234.jpg",
    nickname: "Neo",
  }, //必须是一个对象，pubsub选填，im必填，最大长度300字符，用于上下线提醒和查询在线用户列表时，扩展更多的属性
});

// 全局挂载
app.config.globalProperties.$goeasy = goeasy;

app.use(MobileAdaptation).use(store).use(router).mount("#app");
